182f009b432b72d83e92c4725c7b9ac89263153d,plugins/git4idea/src/git4idea/actions/GitCompareWithBranchAction.java,GitCompareWithBranchAction,actionPerformed,#AnActionEvent#,63
Before Change
}
};
popup.set(new ListPopupImpl(branchesStep));
popup.get().showInBestPositionFor(event.getDataContext());
}
private static void notifyError(Project project, String message, Throwable t) {
After Change
final String currentBranch = curBranch.getName();
// prepare and invoke popup
final JBList list = new JBList(branches);
list.installCellRenderer(new NotNullFunction<GitBranch, JComponent>() { // display current branch in bold with asterisk
@NotNull public JComponent fun(GitBranch branch) {
if (branch.isActive()) {
JLabel label = new JLabel(branch.getName() + " *");
final Map<TextAttribute, Float> attributes = new HashMap<TextAttribute, Float>(1);
attributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
label.setFont(label.getFont().deriveFont(attributes));
return label;
}
return new JLabel(branch.getName());
}
});
JBPopupFactory.getInstance()
.createListPopupBuilder(list)
.setTitle("Select branch to compare")
.setItemChoosenCallback(
new Runnable() {
public void run() {
Application app = ApplicationManager.getApplication();
if (project.isDisposed() || app == null || !app.isActive() || app.isDisposed() || app.isDisposeInProgress()) { // safe check
return;
}
ApplicationManager.getApplication()
.invokeLater(new Runnable() { // don't block awt thread - getting revision content may take long
@Override
public void run() {
try {
showDiffWithBranch(project, file, currentBranch, list.getSelectedValue().toString());
}
catch (Exception e) {
notifyError(project, "Couldn't compare file [" + file + "] with selected branch [" + list.getSelectedValue() + "]", e);
}
}
});
}
})
.setAutoselectOnMouseMove(true)
.createPopup()
.showInBestPositionFor(event.getDataContext());
}
private static void notifyError(Project project, String message, Throwable t) {